<template>
  <div>
    <!-- 遍历将每条主评论显示 comment:每个评论的对象-->
    <Main
      v-for="(comment, index) in commentList"
      :key="index"
      :commentMain="comment"
    />
  </div>
</template>

<script>
import Main from "../components/comment/Main";

export default {
  data() {
    return {
      commentList: [],
    };
  },
  components: {
    Main,
  },
  created() {
    // 根据文章的id 获取评论数据
    this.$axios({
      url: "/post_comment/" + 2,
    }).then((res) => {
      // console.log(res.data.data);
      // 获取评论数据
      this.commentList = res.data.data;
    });
  },
};
</script>
<style lang="less" scoped></style>
